import { defineStore } from "pinia";

//管理员权限
export const useAdminRightsStore = defineStore("adminRights", {
    //真正储存数据的地方
  state: () =>{
    return {
      rights : '',
    };
  },
  actions:{
    setRights(rights){
      this.rights = rights;
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'adminRights',
        storage: localStorage,
        paths: ['rights']
      }
    ]
  }
});

//员工信息储存
export const empAccount = defineStore("empAccount", {
    //真正储存数据的地方
  state: () =>{
    return {
      id:'',
      account : '',
      gender:'',
      name:'',
      image:'',
      onlineStartTime:'',
      loginDate:'',
    };
  },
  actions:{
    setEmpAccount(empAccount){
      this.empAccount = empAccount;
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'empAccount',
        storage: localStorage,
        paths: ['account']
      }
    ]
  }
});

//管理员账号
export const adminAccount = defineStore("adminAccount", {
    //真正储存数据的地方
  state: () =>{
    return {
      account : '',
    };
  },
  actions:{
    setEmpName(account){
      this.account = account;
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'adminAccount',
        storage: localStorage,
        paths: ['account']
      }
    ]
  }
});

//消息数量储存
export const msgNum = defineStore("msgNum", {
    //真正储存数据的地方
  state: () =>{
    return {
      msgNum : 0,
    };
  },
  actions:{
    setMsgNum(msgNum){
      this.msgNum = msgNum;
    }
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'msgNum',
        storage: localStorage,
        paths: ['num']
      }
    ]
  }
});